require 'crawler/crawler'
require 'uri'
require 'date'

module Crawler
  
  class TwitterCrawler < Crawler
    
    public
    
    def initialize(args = {})
      super args
    end
    
    def service_name
      'twitter'
    end
    
    def crawl_table
      TwitterCrawl  
    end
    
    protected
    
    def crawl(c)
      request_uri = "http://api.twitter.com/1/users/show.xml?screen_name=#{c.service.username_on_service}"
      @curl.url = request_uri
      @curl.http_get
      c.status = @curl.response_code
      c.body = @curl.body_str
      @curl.response_code == 200
    end
    
    def has_crawl?(s)
      !s.twitter_crawl.nil?
    end
  end
  
end